<template>
  <div>
    <div class="block">
      <span class="demonstration"></span>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        layout="prev, pager, next, jumper"
        :total="600"
        :page-size="pageSize"
        background
      ></el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  props: ["pageSize"],
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.$parent.pageSize = val;
      this.$parent.getData();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.$parent.page = val;
      this.$parent.getData();
    }
  },
  data() {
    return {
      currentPage: this.page
    };
  }
};
</script>

<style lang="less" scoped>
.block {
  margin-top: 20px;
  padding-bottom: 10px;
}
/deep/.el-pagination.is-background .btn-next,
.el-pagination.is-background .btn-prev {
  border-radius: -1px !important;
}
.el-pagination {
  display: flex;
  justify-content: flex-end;
}
/deep/ .el-pagination.is-background .el-pager li {
  border: 2px solid #ccc;
  border-radius: 50%;
  // height: 20px;
  line-height: 25px;
  max-width: 15px;
  margin: 0 7px;
}
/deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #989cee;
  color: white;
}
/deep/.el-pagination__editor.el-input .el-input__inner {
  border: 2px solid #ccc;
  border-radius: 50%;
  width: 30px;
  height: 30px;
}
/deep/.el-pagination button {
  border: 2px solid #ccc;
  border-radius: 50% !important;
  width: 30px;
  height: 30px;
}
</style>